home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Source Code
/
C++
/
Frameworks
/
Sprocket Framework DR2
/
Sprocket Starter
/
SprocketStarter Code
/
TextWindow.h
< prev
next >
Wrap
Text File
|
1996-06-12
|
4KB
|
166 lines
/*
** File: TextWindow.h
**
** Written by: Bill Hayden
** Nikol Software
**
** Copyright © 1995-1996 Nikol Software
** All rights reserved.
*/
#pragma once
#include "Window.h"
#include "UTextWindow.h"
#include "WASTE.h"
#include "File.h"
class TTextWindow : public TWindow
{
public:
TTextWindow(void);
virtual ~TTextWindow();
//OSErr ITextWindow(void);
OSErr ITextWindow(FSSpecPtr filespec = nil);
// Event routing methods
virtual Boolean EventFilter(EventRecord * theEvent);
// Methods which MUST be overridden:
virtual WindowRef MakeNewWindow(WindowRef behindWindow);
// Methods which probably should be overridden
virtual void AdjustCursor(EventRecord * anEvent);
virtual void Idle(EventRecord * anEvent);
virtual void Activate(Boolean activating);
virtual void Draw(void);
virtual void KeyDown(EventRecord * anEvent);
virtual void GetPerfectWindowSize(Rect * perfectSize);
virtual void GetWindowSizeLimits(Rect * limits);
virtual void AdjustForNewWindowSize(Rect * oldRect,Rect * newRect);
virtual void Click(EventRecord * anEvent);
// Window property accessor methods…
virtual Boolean CanClose(Boolean quitting);
virtual Boolean Close(void);
//virtual Boolean DeleteAfterClose(void);
// Methods for handling menus & menu commands
virtual void AdjustMenusBeforeMenuSelection(void);
virtual Boolean DoMenuSelection(short menu, short item);
virtual Boolean DoCommand(CommandID theCommand);
// Methods for use with the Drag Manager
virtual OSErr DragEnterWindow(DragReference theDrag);
virtual OSErr DragInWindow(DragReference theDrag);
virtual OSErr DragLeaveWindow(DragReference theDrag);
virtual OSErr HandleDrop(DragReference theDragRef);
//virtual Boolean IsPointInContentRgn( Point pt );
//virtual Boolean IsMouseInContentRgn( DragReference dragRef );
void GetWERect(LongRect& teRect);
Boolean HaveSelection();
void GetScrollBarRect( VHSelect axis, Rect *barRect );
void GetTextRect( Rect *textRect );
void GetGrowIconRect( Rect *iconRect );
void ViewChanged( void );
void AdjustBars( void );
void ScrollBarChanged( void );
void DoScrollKey( SignedByte keyCode );
void DoScrollBar( Point hitPt, EventModifiers modifiers );
OSErr SafeSaveFile(Boolean replacing, FSSpec& filespec);
static void SetUpStaticMenu( void );
protected:
static MenuRef fFontMenu;
static MenuRef fSizeMenu;
static MenuRef fStyleMenu;
static MenuRef fColorMenu;
public:
WEHandle fWEHandle;
TFile* fBackingFile;
ControlRef fDocHScroll;
ControlRef fDocVScroll;
ControlRef fSaveButton;
ControlRef fLeftAlignButton;
ControlRef fCenterAlignButton;
ControlRef fRightAlignButton;
ControlRef fJustifyButton;
ControlRef fPlainButton;
ControlRef fBoldButton;
ControlRef fItalicButton;
ControlRef fUnderlineButton;
ControlRef fBlackButton;
ControlRef fBlueButton;
ControlRef fGreenButton;
ControlRef fRedButton;
ControlRef fPinkButton;
ControlRef fOrangeButton;
ControlRef fBrownButton;
short fToolbarHeight; // for top toolbar
Str255 fName;
};
enum
{
kStyleBase = 700,
kSizeBase = 600
};
// resource types, clipboard types, and file types
#define kTypeDeskAccessory 'DRVR'
#define kTypeFont 'FONT'
#define kTypePicture 'PICT'
#define kTypeSound 'snd '
#define kTypeSoup 'SOUP'
#define kTypeStyles 'styl'
#define kTypeText 'TEXT'
#define kTypeTextReadOnly 'ttro'
// virtual key codes for navigation keys found on extended keyboards
#define keyPgUp 0x74
#define keyPgDn 0x79
#define keyHome 0x73
#define keyEnd 0x77
// virtual key codes generated by some function keys
#define keyF1 0x7A
#define keyF2 0x78
#define keyF3 0x63
#define keyF4 0x76